/**
 * @param query [any] 参数
 * @param url [string] 路径
 * @example query2url(query,url);
 */
export default function query2url(query: any, url: string) {
	// return generate(query, url);

	const usp = new URLSearchParams();
	for (const k in query) {
		if (query.hasOwnProperty(k)) {
			usp.append(k, query[k]);
		}
	}
	const url_param = usp.toString();
	const _url = url.split('?')[0] + (url_param && url_param.length !== 0 ? '?' + url_param : '');
	return _url;
}
